


#include "daqAdapter.h"
#include <iostream>

using namespace std;
int main(int argc, char**argv)
{

	//test daqIn
	{
		DaqIO daqIn ("PXI1Slot2/ai0:10,PXI1Slot2/ai11",100,-1,6,true);
		cout << "daqIn Read Channels: " << daqIn.numChan << endl;
		cout << "Test read 10hz, 5 samples, only show ch0" << endl;
		double *data = new double[daqIn.numChan];
		for(int i=0;i<5;i++){
			daqIn.read(data);
			cout << data[0] << " ";
		}
		cout << endl;
		delete[] data;
	}

	//daqOut
	{
		DaqIO daqOut ("PXI1Slot4/ao0:31",100,2,8);
		cout << "daqOut Write Channels: " << daqOut.numChan << endl;
		double *data = new double[daqOut.numChan];
		for(uInt32 i=0;i<daqOut.numChan;i++)
			data[i] = (double)i/daqOut.numChan+3;
		daqOut.write(data);
		delete[] data;
	}

	//test daqGroupIO read
	{
		vector<string> inChan;
		inChan.push_back("PXI1Slot2/ai0:61");
		inChan.push_back("PXI1Slot3/ai0:79");
		DaqGroupIO daqIn(inChan,100,-1,6);
		cout << "daqIn read Channels :" << daqIn.numChan << endl;
		double *data = new double[daqIn.numChan];
		for(int i=0;i<10;i++)
			daqIn.read(data);
		delete[] data;
	}

	//test daqGroupIO write
	{
		vector<string> outChan;
		outChan.push_back("PXI1Slot4/ao0:31");
		outChan.push_back("PXI1Slot5/ao0:31");
		outChan.push_back("PXI1Slot6/ao0:23");
		DaqGroupIO daqOut(outChan,100,2,8);
		cout << "daqOut write Channels :" << daqOut.numChan << endl;
		double *data = new double[daqOut.numChan];
		for(unsigned int i=0;i<daqOut.numChan;i++)
			data[i]=3+(double)i/daqOut.numChan;
		daqOut.write(data);
		delete[] data;
	}


	return 0;
}
